<div>
<ol class="breadcrumb">
    <li> <i class="fa fa-anchor"></i>
        &nbsp;站点管理
    </li>
    <li>添加站点</li>
</ol>
<table class="table table-mcit">
    <tr>
        <td>
            <form class="form-horizontal" role="form" method="post" action={:U("Site/add")} id="form_check" enctype="multipart/form-data">
<div class="col-xs-12">
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;站点名称</label>
        <div class="col-sm-9">
            <input type="text" class="form-control required" placeholder="" name="name" id="name">
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;站点坐标</label>
        <div class="col-sm-9">
            <input type="text" class="form-control required" placeholder=""  name="coordinate" id="coordinate">
        </div>
    </div>
</div><div class="clearfix"></div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;运行模式</label>
        <div class="col-sm-9">
            <label class="radiomode">
                <input type="radio" name="plant_mode" id="plant_mode_0" value="0" checked> 线上
            </label>
            <label class="radiomode">
                <input type="radio" name="plant_mode" id="plant_mode_1" value="1"> 离线
            </label>
        </div>
    </div>
</div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;所在商圈/楼盘</label>
        <div class="col-sm-9">
            <input type="text" class="form-control " placeholder=""  name="circle" id="circle">
        </div>
    </div>
</div><div class="clearfix"></div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;所在城市</label>
        <div class="col-sm-9">
            <div class="col-sm-13 control-whole">
                <select id="location-f" name="location_f_1" class="form-control" style="width:130px;">
                    <option value="0">--</option>
                    <volist name="china" id="vo">
                        <option value="{$vo.code}">{$vo.name}</option>
                    </volist>
                </select>

                <select id="location-s" name="location_s_1" class="form-control" style="width:131px;border-left:0">
                    <option value="0">--</option>
                    <volist name="china" id="vo">
                        <volist name="vo['area']" id="vovo">
                            <option value="{$vovo.code}" class="{$vo.code}" >{$vovo.name}</option>
                        </volist>
                    </volist>
                </select>

                <select id="location-t" name="location_t_1" class="form-control required" style="width:120px;border-left:0">
                    <option value="0">--</option>
                    <volist name="china" id="vo">
                        <volist name="vo['area']" id="vovo">
                            <volist name="vovo['area']" id="vovovo">
                                <option value="{$vovovo.code}" class="{$vovo.code}" >{$vovovo.name}</option>
                            </volist>
                        </volist>
                    </volist>
                </select>
            </div>
        </div>
    </div>
</div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;状态服务器</label>

        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder="ip地址"  name="state_IP" id="state_IP">
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;详细地址</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="address" id="address">
        </div>
    </div>
</div>
<!--<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;站级编号</label>

        <div class="col-sm-9">
            <input type="text" class="form-control required" maxlength="12" placeholder="12位数字编码"  name="station_key" id="station_key">
            <span class="help-block error-block"></span>
            <span class="help-block"></span>
        </div>
    </div>
</div>-->
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;场地性质</label>
        <div class="col-sm-9">
            <select  name="type" class="form-control required">
                <option value="1">充电点</option>
                <option value="2">家庭</option>
                <option value="3">充电站</option>
            </select>
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;当前状态</label>

        <div class="col-sm-9">
            <select  name="current_state" class="form-control required">
                <option value="1">运营中</option>
                <option value="3">规划中</option>
                <option value="2">安装中</option>
            </select>
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;支持预约</label>
        <div class="col-sm-9">
            <select  name="booking" class="form-control required">
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;电流类型</label>
        <div class="col-sm-9">
            <select  name="evc_type" class="form-control required">
                <option value="2">交流</option>
                <option value="1">直流</option>
                <option value="3">混合</option>
            </select>
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;支持WIFI</label>
        <div class="col-sm-9">
            <select  name="wifi" class="form-control required">
                <option value="0">否</option>
                <option value="1">是</option>
            </select>
        </div>

    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;支持实时</label>
        <div class="col-sm-9">
            <select  name="is_active" class="form-control required">
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;快充数量</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="charge_fast_num" >
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;慢充数量</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="charge_slow_num" >
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;运营服务商</label>
        <div class="col-sm-9">
            <select  name="oper_id" class="form-control required">
                <volist name="oper" id="oper">
                    <option value="{$oper.id}">{$oper.oper_name}</option>
                </volist>
            </select>
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;充电接口类型</label>
        <div class="col-sm-9">
            <select  name="charge_port_type" class="form-control required">
                <option value="2">特斯拉</option>
                <option value="1">国标</option>
                <option value="3">ABB</option>
                <option value="4">其他</option>
            </select>
        </div>
    </div>
</div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;设备商</label>
        <div class="col-sm-9">
            <select  name="plant_type" class="form-control required">
                <option value="00000000">未设置</option>
                <volist name="fac" id="fac">
                    <option value="{$fac.fac_login_name}">{$fac.fac_name}</option>
                </volist>
            </select>
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;停车费参考价</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="park_fee" >
        </div>
    </div>
</div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;充电费参考价</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="charger_fee" >
        </div>
    </div>
</div>




<div class="col-xs-6">
    <div class="form-group">

        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;信息来源</label>
        <div class="col-sm-9">
            <select  name="source" class="form-control required">
                <option value="6">--</option>
                <volist name="source" id="oper">
                    <option value="{$oper.id}">{$oper.name}</option>
                </volist>
            </select>
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">

        <label class="col-sm-3 control-label">&nbsp;充电支付方式</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" placeholder=""  name="pay_manner" >
        </div>
    </div>
</div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;经营性质</label>
        <div class="col-sm-9">
            <label class="radio-inline">
                <input type="radio" name="nature" id="" value="4" checked> 未定
            </label>
            <label class="radio-inline">
                <input type="radio" name="nature" id="inlineRadio8" value="3"> 自营
            </label>
            <label class="radio-inline">
                <input type="radio" name="nature" id="inlineRadio9" value="2"> 第三方
            </label>
            <label class="radio-inline">
                <input type="radio" name="nature" id="inlineRadio10" value="1"> 私人
            </label>
            <div id="nature_1" style="display: none">
                <p><input type="text" style="background-color: #FCF8E3" name="private_account"/>&nbsp;&nbsp;分享用户账号</p>
                <p><input type="text" style="background-color: #FCF8E3" name="private_name"/>&nbsp;&nbsp;分享用户名称</p>
                <p><input type="text" style="background-color: #FCF8E3" minlength='7' maxlength='11' name="private_phone"/>&nbsp;&nbsp;分享用户电话</p>
            </div>
            <div id="nature_2" style="display: none">
                <p><input type="text" style="background-color: #FCF8E3" name="regulated"/>&nbsp;&nbsp;监管方</p>
                <p><input type="text" style="background-color: #FCF8E3" minlength='7' maxlength='11' name="regulated_phone"/>&nbsp;&nbsp;监管方电话</p>
                <p><input type="text" style="background-color: #FCF8E3" name="company"/>&nbsp;&nbsp;公司</p>
                <p><input type="text" style="background-color: #FCF8E3" minlength='7' maxlength='11' name="company_phone"/>&nbsp;&nbsp;公司电话</p>
            </div>
            <div id="nature_3" style="display: none">
                <p><input type="text" style="background-color: #FCF8E3" minlength='7' maxlength='11' name="tel"/>&nbsp;&nbsp;电话</p>
            </div>
        </div>
    </div>
</div><div class="clearfix"></div>



<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">&nbsp;站点描述</label>
        <div class="col-sm-9">
            <textarea class="form-control" rows="3" name="describes"></textarea>
        </div>
    </div>
</div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;停车处位置</label>
        <div class="col-sm-9">
            <label class="radio-inline">
                <input type="radio" name="floor"  id="inlineRadio11" value="1" checked> 停车楼
            </label>
            <label class="radio-inline">
                <input type="radio" name="floor" id="inlineRadio12" value="2"> 室外
            </label>
            <label class="radio-inline">
                <input type="radio" name="floor" id="inlineRadio13" value="3"> 地下室
            </label>
            <div>
                <input id="show-1" type="text"  name="parking"  style="background-color: #FCF8E3" placeholder="楼层"/>
                <input id="show-3" style="display: none;background-color: #FCF8E3" type="text" name="parking"  placeholder="所在位置"/>
                <input id="show-2" style="display: none;background-color: #FCF8E3" type="text" name="parking"  placeholder="(例：南大门门口)"/>
            </div>
        </div>
    </div>
</div><div class="clearfix"></div>




<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;信息来源</label>
        <div class="col-sm-9">
            <select  name="source" class="form-control required">
            	<option value="6">--</option>
                <volist name="source" id="oper">
                    <option value="{$oper.id}">{$oper.name}</option>
                </volist>
            </select>
        </div>
    </div>
</div>


<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label">
            &nbsp;环境照片
        </label>
        <div class="col-sm-9">
            <input type="file"  name="photo" style="margin-top: 5px;">
            <span class="help-block error-block"></span>
            <span class="help-block">
                <i class="fa fa-hand-o-up"></i>
                &nbsp;上传照片。格式仅限'jpg', 'gif', 'png', 'jpeg'类型。
            </span>
        </div>
    </div>
</div><div class="clearfix"></div>

<div class="col-xs-6">
    <div class="form-group">
        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;建立时间</label>

        <div class="col-sm-9">
            <input type="text" class="form-control required form_month" placeholder="点击选择" name="establish_time" id="establish_time" data-date-format="yyyy-mm-dd" data-link-format="yyyy-mm-dd">
        </div>
    </div>
</div><div class="clearfix"></div>
<div class="col-xs-6">
    <div class="form-group">
        <div class="col-sm-offset-9 col-sm-9">
            <button type="submit" class="btn btn-primary"><i class="fa fa-upload"></i>&nbsp;提交</button>
            <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
        </div>
    </div>
</div>
</form>
        </td>
    </tr>
</table>
</div>
</div>
<import type='css' file="css.datetimepicker" />
<import file="js.bootstrap-datetimepicker#min" />
<import file="js.bootstrap-datetimepicker#zh-CN" />
<import file="js.jquery#chained" />
<import file="js.maskedinput" />
<script>
    $(document).ready(function () {
        $("#location-s").chained("#location-f");
        $("#location-t").chained("#location-s");

        $(".form_month").datetimepicker({
            language: 'zh-CN',
            autoclose: true,
            startView:'month',
            minView: 'month',
            todayBtn: true,
            viewSelect: 'year',
            pickerPosition: "bottom-left"
        });
        //停车处选择按钮控制
        $("input[name='floor']").click(function(){
            if($("input[name='floor']:checked").val() == 1){
                $("#show-1").show();
                $("#show-2").hide();
                $("#show-3").hide();
            }else if($("input[name='floor']:checked").val() == 2){
                $("#show-2").show();
                $("#show-1").hide();
                $("#show-3").hide();
            }else{
                $("#show-3").show();
                $("#show-1").hide();
                $("#show-2").hide();
            }
        });
        //经营性质按钮控制
        $("input[name='nature']").click(function(){
            if($("input[name='nature']:checked").val() ==3){
                $("#nature_3").show();
                $("#nature_1").hide();
                $("#nature_2").hide();
            }else if($("input[name='nature']:checked").val() ==2){
                $("#nature_2").show();
                $("#nature_1").hide();
            }else if($("input[name='nature']:checked").val() ==1){
                $("#nature_1").show();
                $("#nature_2").hide();
            }else{
                $("#nature_1").hide();
                $("#nature_2").hide();
                $("#nature_3").hide();
            }
        });


        jQuery.extend(jQuery.validator.messages, {
            required: "必选字段"
        });

        $("#form_check").validate(
                {
                    //debug: true,
                    //调试模式取消submit的默认提交功能
                    onkeyup: false,
                    errorClass: "mcit-error",
                    validClass: "mcit-valid",
                    email:true,
                    // submitHandler: function(form){
                    //     //alert("提交服务器");
                    //     form.submit();提交表单
                    // },
                    rules: {
                        num: {
                            minlength: 9
                        }
                    },
                    messages: {
                        num: {
                            minlength: "格式不对"
                        }
                    },
                    errorPlacement: function (error, element) {
                        error.appendTo(element.next());
                    },
                    highlight: function (element, errorClass) {
                        //$(element).addClass(errorClass);
                        $(element).parent().addClass(errorClass);
                        $(element).next().css("display", "block");
                        $(element).next().next().hide();
                    },
                    success: function (label) {
                        label.parent().next().hide();
                        label.addClass('mcit-valid');
                        label.parent().parent().addClass('mcit-valid');
                        label.parent().css("display", "block");
                        label.html('<i class="fa fa-check"></i>&nbsp;OK');
                    }
                }
        );

    })
</script>